const { ccclass, property } = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    onLoad() {
        let sprite = this.node.getComponent(cc.Sprite);
        cc.resources.load<cc.SpriteFrame>('GrassSolid001', cc.SpriteFrame, (err, asset) => {
            sprite.spriteFrame = asset;
        });


    }

    start() {
        setTimeout(this.loadAsset.bind(this), 1000);
    }

    loadAsset() {
        cc.resources.load<cc.SpriteFrame>('GrassSolid001', cc.SpriteFrame, (err, asset) => {
            this.node.getComponent(cc.Sprite).spriteFrame = asset;
        });
    }

    // update (dt) {}
}
